package cn.com.taiji.pos.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.github.dreamyoung.mprelation.EntityMapper;
import com.github.dreamyoung.mprelation.JoinColumn;
import com.github.dreamyoung.mprelation.ManyToOne;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;

/**
 * <p>
 * 账户信息
 * </p>
 *
 * @author
 * @since 2021-03-01
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class CardAccount implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 主键
     */
    @TableId("ID")
    private String id;

    /**
     * 账户编号
     */
    @TableField("ACCOUNT_NO")
    private String accountNo;

    /**
     * 账户类型
     */
    @TableField("ACCOUNT_TYPE_ID")
    private String accountTypeId;
    @TableField(exist = false)
    @EntityMapper
    @ManyToOne
    @JoinColumn(name = "account_type_id", referencedColumnName = "id")
    private CardAccountType accountType;

    /**
     * 所属顾客
     */
    @TableField("CUSTOMER_ID")
    private String customerId;
    @TableField(exist = false)
    @EntityMapper
    @ManyToOne
    @JoinColumn(name = "customer_id", referencedColumnName = "id")
    private CardCustomer customer;

    /**
     * 账户余额
     */
    @TableField("AMOUNT")
    private BigDecimal amount;

    /**
     * 账户次数
     */
    @TableField("TIMES")
    private Integer times;

    /**
     * 所属餐次
     */
    @TableField("MEAL_TIME_ID")
    private String mealTimeId;

    /**
     * 有效截至日期
     */
    @TableField("EFFECT_DATE")
    private LocalDate effectDate;

    /**
     * 开户地点
     */
    @TableField("OPEN_LOCATION")
    private String openLocation;

    /**
     * 相关描述
     */
    @TableField("DESCRIPTION")
    private String description;

    /**
     * 状态(0:启用,1:停用)
     */
    @TableField("STATUS")
    private String status;

    /**
     * 创建人
     */
    @TableField("CREATOR_ID")
    private String creatorId;

    /**
     * 创建人姓名
     */
    @TableField("CREATOR_NAME")
    private String creatorName;

    /**
     * 创建时间
     */
    @TableField("CREATE_TIME")
    private LocalDateTime createTime;

    @TableField("TIMES_AMOUNT")
    private Integer timesAmount;

    /**
     * 是否导出xml(0:否1:是)
     */
    @TableField("XML_OUT")
    private String xmlOut;

    @TableField("LAST_XML")
    private BigDecimal lastXml;

    @TableField("isBinDing")
    private String isBinDing;

    @TableField("idNumber")
    private String idNumber;

    @TableField(exist = false)
    private String catSortNo;//账户类型排序
    @TableField(exist = false)
    private String cmtName;//餐次名称
    @TableField(exist = false)
    private String sddName;
    @TableField(exist = false)
    private String catName;//账户类型名称
    @TableField(exist = false)
    private String cctID;//顾客类型id
    /**
     * 顾客关联卡片
     */
    @TableField(exist = false)
    @EntityMapper
    @ManyToOne
    @JoinColumn(name = "customer_id", referencedColumnName = "customer_id")
    private CardInfo cardInfo;


}
